package model.bullets;

import model.enemies.IEnemy;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import com.example.towerdefence.R;
import controller.GameBoard;

public class FrostBullet extends BulletSprite {

	private static final Bitmap BULLET_IMAGE = BitmapFactory.decodeResource(
			GameBoard.getRes(), R.drawable.frost_bullet);
	private static final int DAMAGE = 2;
	private int slow;

	public FrostBullet(float x, float y, IEnemy enemy, int slow) {
		setImage(BULLET_IMAGE);
		setDamage(DAMAGE);
		setxAxisPoint(x);
		setyAxisPoint(y);
		setEnemy(enemy);
		setSlow(slow);
	}

	public int getSlow() {
		return slow;
	}

	public void setSlow(int slow) {
		if (slow > 0)
			this.slow = slow;
	}

	/**
	 * Overrides hit method and if hit slows down the enemy.
	 */
	@Override
	public void hit() {
		super.hit();
				if(super.getEnemy().getSpeed().getxVelocity() == 0){
					super.getEnemy().getSpeed().setyVelocity(slow);
				}
				if(super.getEnemy().getSpeed().getyVelocity() == 0){
					super.getEnemy().getSpeed().setxVelocity(slow);
				}
		}
}
